import instance from "@/utils/request";

//查询订单
export  function findAll(){
    return instance.get("/order/h")
}
//分页查询
export function  pageInfo(searchParams){
    return instance.get("/order/page",{params:searchParams})
}
export function selectById(id) {
    return instance.get(`/order/findById/${id}`);
}

/**
 * 得到数据字典
 * @returns {Promise<AxiosResponse<any>>}
 * @constructor
 */
export function GetdataDictionary (){
    return instance.get("/order/dic")
}
////////////////////////////////////////orderInfo
/**
 * 根据订单号得到该订单商品信息
 */
export  function  findOrderGoods(orderId){
    return instance.get(`/orderGoods/find/${orderId}`)

}
/**
 * 根据订单id 得到收货人信息
 * @param orderId
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  findReceiverByOrderId(orderId){
    return instance.get(`receive/man/${orderId}`)
}

/**
 * 根据商品编号批量得到商品
 * @param idList
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  findGoodList(idList){
    return instance.get(`addOrder/findGoodList/${idList}`)
}



//////////////////////////////////////////////////////////////////////
/**
 * 商品详细信息
 */
export function productInfo(searchParams){
    return instance.get("/orderGoods/page",{params:searchParams})
}



/**
 * 查询所有颜色
 * @returns {Promise<AxiosResponse<any>>}
 */
export function findColorList(){
    return instance.get("/orderGoods/colorList")
}

/**
 * 查询所有商品分类
 * @returns {Promise<AxiosResponse<any>>}
 */
export function findTypeList(){
    return instance.get("/orderGoods/typeList")
}

/**
 * 查询所有品牌分类
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function findBrandList(){
    return instance.get("orderGoods/brandList")
}

/**
 * 批量查询
 * @param idList
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  findeOrderByIdList(idList){
    return instance.get(`/order/f/${idList}`)
}



/**
 * 根据id 得到订单详情
 * @param id
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  findOrderInfo(id){
    return instance.get(`order/findOrder/${id}`)
}

/**
 * 导出
 * @param idList
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  excelPort(idList){
    return instance.post(`/order/excel/${idList}`)
}
////////////////////////////////////
/**
 * 导出
 * @param idList
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  excel(idList){
    return instance.post(`/order/exportExcel/${idList}`)
}
/////////////////////////////////////

/**
 * 批量生成出库单
 * @param idList
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function outStock(idList){
    return instance.get(`/order/order/outStock/${idList}`)
}

/**
 * 待出库的订单
 * @param searchParams
 * @returns {Promise<AxiosResponse<any>>}
 */
export function orderOutStock(searchParams){
    return instance.get("orderOutStock/page",{params:searchParams})
}

/**
 * 退货订单
 * @param searchParams
 * @returns {Promise<AxiosResponse<any>>}
 */
export function  returnGood(searchParams){
    return instance.get("/return/page",{params:searchParams})
}


/**
 * 根据订单id更改订单状态
 * @param orderId
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  changeOrderStatus(orderId){
    return instance.get(`order/up/${orderId}`)
}

/**
 * 查询商品信息
 * @returns {Promise<AxiosResponse<any>>}
 * @constructor
 */
export function GoodsInfo(){
return instance.get("/goods/findList")
}

//========================================================================
///////添加商品订单信息
//根据商品id 得到商品信息
export  function  findGoodById(orderId){
    return instance.get(`/addOrder/findGood${orderId}`)
}





/**
 * 查看购物车
 * @returns {Promise<AxiosResponse<any>>}
 */
export function show(){
    return instance.get("/shopping/showAll")
}

/***
 *批量删除购物车中的商品
 * @param idList
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  deleteByBatchId(idList){
    return instance.post(`/shopping/delete/${idList}`)
}

/**
 * 单个删除
 * @param id
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  del(id){
    return instance.post(`/shopping/del/${id}`)
}
/**
 * 添加商品
 * @param goodsData
 * @returns {Promise<AxiosResponse<any>>}
 */
export function add(entity){
    return instance.post(`/shopping/add/`,entity)
}

/**
 * 批量添加
 * @param entity
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function addArray(goodArray) {
    return instance.post(`/shopping/addArray`,goodArray)
}


/**
 * 添加收货人信息
 * @param entity
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  addReceiver(entity){
 return instance.get(`/receive/add`,entity)
}

/**
 * 根据商品id得到商品信息
 * @param id
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  getGoodInfo(id){
    return instance.get(`/goods/findById/${id}`)
}

/**
 * 添加订单信息
 * @param entorderAndGoodAndReceiverity
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  addOrderInfo(entity){
    return instance.post(`/addOrder/add/`,entity)
}

/**
 * 批量结算
 * @param entity
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  addOrderInfoList(entity){
    return instance.post(`/addOrder/addList/`,entity)
}

/**
 * 网店订单信息
 * @returns {Promise<AxiosResponse<any>>}
 */
export  function  showOnlineOrder(searchParams){
    return instance.get("/OnlineOrder/page",{params:searchParams})
}


